home *** CD-ROM | disk | FTP | other *** search
/ Enter 2005 October / enter-2005-10.iso / files / jedit42install.exe / {app} / macros / Clipboard / Copy_Selection_or_Line.bsh < prev    next >
Encoding:
Text File  |  2004-08-29  |  814 b   |  35 lines

  1. /*
  2. * Copy_Selection_or_Line.bsh - a BeanShell macro for jEdit
  3. * which copies either the selected text, or the current line 
  4. * if no text is selected, to the clipboard.
  5. *
  6. * Copyright (C) 2003 Ollie Rutherfurd <oliver@jedit.org>
  7. *
  8. * $Id: Copy_Selection_or_Line.bsh,v 1.1 2004/08/03 21:31:47 orutherfurd Exp $
  9. */
  10.  
  11. copySelectionOrLine(){
  12.     selections = textArea.getSelection();
  13.     if(selections.length == 0){
  14.         textArea.smartHome(false);
  15.         textArea.smartEnd(true);
  16.     }
  17.     Registers.copy(textArea,'$');
  18. }
  19.  
  20. copySelectionOrLine();
  21.  
  22. /*
  23.     Macro index data (in DocBook format)
  24.  
  25. <listitem>
  26.     <para><filename>Copy_Selection_or_Line.bsh</filename>
  27.     <abstract><para>
  28.         If no text is selected, the current line is copied to 
  29.         the clipboard, otherwise the selected text is copied 
  30.         to the clipboard.
  31.     </para></abstract>
  32. </listitem>
  33.  
  34. */
  35.